/*
 * @Descripttion: 
 * @Author: chendingfengmail@163.com
 * @version: 
 * @Date: 2021-04-07 08:21:18
 * @LastEditors: chendingfengmail@163.com
 * @LastEditTime: 2022-01-12 11:05:08
 */
import Vue from 'vue'
import util from '@/libs/util.js'
import ddContainer from './dd-container'
import ddTable from './dd-table'
import ddFileUpload from './dd-file-upload'
import ddTreeBox from './dd-tree-box'
import ddDrawer from './dd-drawer'
import ddIcon from './dd-icon'
import ddIconSvg from './dd-icon-svg'
import { message } from './dd-message/index'
import ddUpload from './dd-upload'
import ddMqtt from './dd-mqtt'
import ddCard from './dd-card'
import ddVideoControl from './dd-video-control'
import ddHlsPlayer from './dd-hls-player'
import ddMapLocation from './dd-map-location'
import ddMapArea from './dd-map-area'
import ddFileUploadText from './dd-file-upload-text'

// 注意 有些组件使用异步加载会有影响
Vue.component('dd-container', ddContainer)
Vue.component('dd-card', ddCard)
Vue.component('dd-drawer', ddDrawer)
Vue.component('dd-tree-box', ddTreeBox)
Vue.component('dd-table', ddTable)
Vue.component('dd-upload', ddUpload)
Vue.component('dd-file-upload', ddFileUpload)
Vue.component('dd-icon', ddIcon)
Vue.component('dd-icon-svg', ddIconSvg)
Vue.component('dd-mqtt', ddMqtt)
Vue.component('dd-video-control', ddVideoControl)
Vue.component('dd-hls-player', ddHlsPlayer)
Vue.component('dd-map-location', ddMapLocation)
Vue.component('dd-map-area', ddMapArea)
Vue.component('dd-file-upload-text', ddFileUploadText)


// 挂在全局方法
// 格式化时间对象
Vue.prototype.formatDate = function (date, fmt) {
  if (date == undefined) {
    return "";
  }
  // 兼容性处理
  let distDate = util.compatibility.handleDate(date);
  return util.date.formatDate(distDate, fmt);
}

// 布尔枚举
Vue.prototype.formatBoolean = function (name, value) {
  return util.formatBoolean(name, value);
}

// 重写el-message组件并挂载于Vue原型
Vue.prototype.$ddMessage = message
